﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>使用DOM实现控件的复制</title>
    <script type="text/javascript">
        function test() {
            var mydom1=document.getElementById("divlist1");//获取指定ID的DOM对象
            var mydom2=document.getElementById("divlist2");//获取指定ID的DOM对象
            mydom2.appendChild(mydom1.childNodes[0].cloneNode(true));
        }
    </script>
</head>
<body>
<form id="form1">
    <input id="btn1" type="button" value="test" onclick="test()"/>
    <div id="divlist1"><p>this is test1</p></div>
    <div id="divlist2"></div>
</form>
</body>
</html>